//
//  WFLoginPasswordCell.m
//  WisdomFarm
//
//  Created by sky on 2017/11/22.
//  Copyright © 2017年 sky. All rights reserved.
//

#import "WFLoginPasswordCell.h"

@implementation WFLoginPasswordCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.separatorInset = UIEdgeInsetsMake(0, 12, 0, 12);
        self.contentView.backgroundColor = [UIColor clearColor];
        self.backgroundColor = [UIColor clearColor];
        
        _innerView = [[UIView alloc] init];
        [self.contentView addSubview:_innerView];
        [_innerView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.insets(UIEdgeInsetsMake(0, 12, 0, 12));
        }];
        self.innerView.backgroundColor = [UIColor whiteColor];
        self.innerView.clipsToBounds = YES;
        
        _iconView = [[UIImageView alloc] init];
        [self.innerView addSubview:_iconView];
        [_iconView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.height.mas_equalTo(27);
            make.left.offset(12);
            make.centerY.offset(0);
        }];
        self.iconView.image = [UIImage imageNamed:@"login_password"];
        
        _textField = [[UITextField alloc] init];
        
        [self.innerView addSubview:_textField];
        [_textField mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.iconView.mas_right).offset(12);
            make.right.offset(-12);
            make.centerY.offset(0);
        }];
        self.textField.textColor = [UIColor textContentColor];
        NSDictionary *attrs = @{
                                NSForegroundColorAttributeName : [UIColor textLightColor]
                                };
        self.textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"请输入密码"
                                                                               attributes:attrs];
        self.textField.secureTextEntry = YES;
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    dispatch_async(dispatch_get_main_queue(), ^{
        [self.innerView sc_setCorners:UIRectCornerBottomLeft|UIRectCornerBottomRight radius:4];
    });
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
